
<%@ include file="/common/taglibs.jsp"%>
<!--分页查询共用的页面-->
<%@ include file="/common/common.jsp"%>
<%@ page language="java" pageEncoding="UTF-8"%>

<%@ page isELIgnored="false" %>
<script>

function processAlarm(tag)
{
    $("#processed").val(tag);
    var vehicleId = ${alarm.vehicleId};
	var alarmId = ${alarmId};
	var param = "?input=true&vehicleId="+vehicleId+"&alarmId="+alarmId;
	// var paramTemp = "?input=true&vehicleId="+vehicleId+"&alarmId="+60911900;
    if(tag == 1)
	{
		//查看
		//查看功能取消，不显示
	    //   var url = "<%=ApplicationPath%>/alarmImage/viewAlarmImage.action"+param;
		//   var title = "${alarm.plateNo}报警处理-查看";
		//   window.parent.closeCommandWindow();
		//   InfoWindow.open(url,  870, 570, title);
	}else if(tag == 2)
	{
		//拍照
	      var url = "<%=ApplicationPath%>/takePicture/view.action"+param;
		  var title = "${alarm.plateNo}报警处理-拍照";
						   window.parent.closeCommandWindow();
          InfoWindow.open(url,   620, 620, title);
	}else if(tag == 3)
	{
		//文本下发
	      var url = "<%=ApplicationPath%>/sendText/view.action"+param;
		  var title = "${alarm.plateNo}报警处理-文本下发";
						   window.parent.closeCommandWindow();
          InfoWindow.open(url,   620, 300, title);
	}else if(tag == 4)
	{
			    $("#entityForm").ajaxSubmit(function(data)
						 {
					          if(data.success)
					         alert("报警已处理,命令下发给终端!");
						   else
							   alert("提交失败! 错误:" + data.message);
						   window.parent.closeCommandWindow();
						 }
					 ); //提交表单
	}
}
	$().ready(function () {
		$("#entityForm").validate(); //初始化验证信息 
		console.log("processAlarm start");
		try {
			var alarmSource = "${alarm.alarmSource}";
			console.log(alarmSource);
			if (alarmSource != "") {
				if(alarmSource.indexOf("adas") >= 0) {
					console.log("为adas报警")
					$("#btnCheck").attr("disabled", false);
				}else{
					$("#btnCheck").attr("disabled", true);
				}

			} else {
				$("#btnCheck").attr("disabled", true);
			}
		} catch (error) {
			console.log(error);
		}
	});
</script>
 <BODY>
	<form id="entityForm" name="entityForm" 
			action='<%=ApplicationPath%>/alarm/process.action' method="POST">
				
        <input type="hidden"  name="alarmId"  id="alarmId" value="${alarmId}"/>
        <input type="hidden"  name="processed"  id="processed" value="1"/>
  <table width="100%"  class="TableBlock">
					<tbody><tr>
						<td colspan="2" style="font-weight: bold; background: #EFEFEF;" height="25">报警信息
						<span style="color:red;background:blue;">${message},${alarmSource}</span>
						</td>
					</tr>
					  <tr>
						<td align="right" width="100">车牌号:</td>
						<td >
						   ${alarm.plateNo}
						</td>
						<tr style="background-color:#CCFFFF">
						<td align="right">报警类型:</td>
						<td >
						   ${alarm.alarmType}
						</td>
					</tr>
					</tr>
					  <tr>
						<td align="right">报警时间:</td>
						<td >
						   ${alarm.alarmTime}
						</td>
						<tr>
						<td align="right">报警地点:</td>
						<td >
						   ${alarm.location}
						</td>
					</tr>
					<tr>
						<td align="right">处理情况:
						</td>
						<td>
						     <input type="text" name="remark" value="${alarm.remark}" />
						   </td>
					</tr>				
					<tr>
						<td colspan=2 align="center">
							<!--<button type="button" id="btnCheck" onclick="processAlarm(1)" class="button gray medium">查看</button> -->
							<button type="button" id="btnTakePicture"  onclick="processAlarm(2)" class="button gray medium">拍照</button> 
							<button type="button" id="btnSendMessage" onclick="processAlarm(3)" class="button gray medium">文本下发</button> 
							<button type="button" id="btnClearAlarm" onclick="processAlarm(4)" class="button gray medium">解除报警</button> 
						</td>						
					</tr>

				
					
				</tbody></table>
 </BODY>
</HTML>
